<template>
    <div class="wf-input-field">
        <div class="body">
            <div class="label">{{ option.label }}</div>
            <div class="input">
                <input
                    :value="value"
                    :type="option.type"
                    :placeholder="option.placeholder"
                    :maxlength="option.maxlength"
                    @input="onInput"
                />
            </div>
        </div>
    </div>
</template>

<script>
export default {
    props: {
        value: {
            type: String
        },
        option: {
            type: Object,
            default() {
                return {
                    type: "text",
                    label: "文本",
                    placeholder: "提示信息",
                    maxlength: "20"
                };
            }
        }
    },
    data() {
        return {};
    },

    methods: {
        onInput(e) {
            this.$emit("input", e.target.value);
        }
    }
};
</script>


<style lang="less" scoped>
.wf-input-field {
    width: 100%;
    padding: 15px 0;
    .body {
        display: flex;
        justify-content: space-between;
        align-items: center;
        white-space: nowrap;
        font-size: 30px;

        .label {
            margin-right: 20px;
        }

        .input {
            flex: 1 1 auto;
            display: flex;
            align-items: center;
            border: 1px solid #b4b4b4;
            border-radius: 8px;
            padding: 20px 0;
            input {
                width: auto;
                min-width: 400px;
                box-sizing: border-box;
                padding: 0 0 0 30px;
                height: 100%;
            }
        }
    }
}
</style>